import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
export const router = createBrowserRouter([
    {
        // 设计并实现路由配置，确保路由正确渲染
        path: '/',
        element: <App></App>,
        children: [
            {
                path: '/home',

                async lazy() {
                    const { default: Home } = await import('../pages/home/Index')
                    return {
                        element: <Home></Home>,
                    }
                }
            },
             {
                path: '/rs',

                async lazy() {
                    const { default: Rs } = await import('../pages/rs/Index')
                    return {
                        element: <Rs></Rs>,
                    }
                }
            },
            {
                path: '/xs',

                async lazy() {
                    const { default: Xs } = await import('../pages/xs/Index')
                    return {
                        element: <Xs></Xs>,
                    }
                }
            },
            {
                path: '/dy',

                async lazy() {
                    const { default: Dy } = await import('../pages/dy/Index')
                    return {
                        element: <Dy></Dy>,
                    }
                }
            }
        ]
    },
     {
                path: '*',

                async lazy() {
                    const { default: Error } = await import('../pages/404/Index')
                    return {
                        element: <Error></Error>,
                    }
                }
            }
])
export default router